import { Component, ViewChild } from '@angular/core';
import { NavController, Slides, IonicPage } from 'ionic-angular';
import { HttpServiceProvider } from '../../providers/http-service/http-service';

@IonicPage()
@Component({
  selector: 'page-home',
  templateUrl: 'home.html'
})
export class HomePage {
    @ViewChild(Slides) slides: Slides;
	  
    homeOptions = {
        initialSlide: 0,
        loop: true,
        autoplay:2000,
        autoplayDisableOnInteraction: false
    };

//fund基金  income收益
    params: any = {data:[
        {fundtype:'套利基金', qitou:'1000',incometype:'年化收益'}, 
         {fundtype:'指数基金', qitou:'5000',incometype:'昨日收益'}],
         events:{}
        };

  	constructor(public navCtrl: NavController,
                public http: HttpServiceProvider) {
      this.homelist()

      this.params.events = {
        'onDetail': (item: any) => {
<<<<<<< HEAD
            console.log(item)
            this.navCtrl.push('MinePage', {item: item});
        }
=======
              this.navCtrl.push('ActdetailPage', {item: item});
          },
          'rect': (item: any) => {
             alert(item)
          },
          'show': (item: any) => {
             alert(item)
          },
>>>>>>> 962917fd6029900f121fcc294b23f2b787e7a75d
      }
  	}

    homelist(){
        this.http.homeActlist((result) =>{
            console.log(result)
        })
    }

  	goToSlide() {
    	this.slides.slideTo(2, 500);
  	}

  	ngAfterViewInit() {
	    this.slides.freeMode = true;
	  }
    onClick(e) {
        alert(e.from)
    }

}
